/*
 * HelloWorldServer.java
 *
 * Created on July 9, 2007, 11:27 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

/**
 *
 * @author alababi
 */
public class HelloWorldServerImpl extends UnicastRemoteObject implements HelloWorld {
    HelloWorldServerImpl() throws RemoteException {
        super();
    }
    
    public static void main(String args[]) {
        try {
            HelloWorldServerImpl Server = new HelloWorldServerImpl();
            //put the local instance in the registry
            Naming.rebind("rmi://127.0.0.1/SAMPLE-SERVER" , Server);
            System.out.println("Server waiting.....");
        } catch (java.net.MalformedURLException me) {
            System.out.println("Malformed URL: " + me.toString());
        } catch (RemoteException re) {
            System.out.println("Remote exception: " + re.toString());
        }
    }

    public String sayHello(String name) throws java.rmi.RemoteException {
        return "Xin chao: " + name;
    }
}
